from django.contrib import admin
from mbook.models import Book, Tag, Tagging

class TaggingInline(admin.TabularInline):
	model = Tagging
	extra = 1

class BookAdmin(admin.ModelAdmin):
	fieldsets = [
		(None, {'fields': ['title', 'author', 'press']}),
		('More Details', {'fields': ['intro', 'pages', 'pub_date', 'isbn', 'num_copy'], 'classes': ['collapse']}),
	]
	inlines = [TaggingInline]
	list_display = ('title', 'author', 'num_copy')

class TagAdmin(admin.ModelAdmin):
	inlines = [TaggingInline]

admin.site.register(Book, BookAdmin)
admin.site.register(Tag, TagAdmin)
